home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / GCC 1.37.1r14 / BSD #includes / machine / machine⁄stdarg.h < prev   
Encoding:
Text File  |  1993-06-23  |  800 b   |  29 lines  |  [TEXT/UNIX]

  1. /* stdarg.h for GNU.
  2.    Note that the type used in va_arg is supposed to match the
  3.    actual type **after default promotions**.
  4.    Thus, va_arg (..., short) is not valid.  */
  5.  
  6. #ifndef _M_STDARG_H
  7. #define _M_STDARG_H
  8.  
  9. #include <stddef.h>
  10.  
  11. /* Amount of space required in an argument list for an arg of type TYPE.
  12.    TYPE may alternatively be an expression whose type is used.  */
  13.  
  14. #define __va_rounded_size(TYPE)  \
  15.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  16.  
  17. #define va_start(AP, LASTARG)                         \
  18.  (AP = (((char *) &LASTARG)+__va_rounded_size(LASTARG)))
  19.  
  20. #define va_end(AP)
  21.  
  22. #define va_arg(AP, TYPE)                        \
  23.  (*((TYPE *) (AP += __va_rounded_size (TYPE),                \
  24.           AP - (sizeof (TYPE) < 4 ? sizeof (TYPE)            \
  25.             : __va_rounded_size (TYPE)))))
  26.  
  27. #endif /* _M_STDARG_H */
  28.  
  29.